package cn.hl.hm.service.impl;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import cn.hl.hm.dao.TFeedbackReplyEntityMapper;
import cn.hl.hm.entity.TFeedbackReplyEntity;
import cn.hl.hm.service.BackstageOperationRecordService;
import cn.hl.hm.service.TFeedbackReplyService;
import cn.hl.hm.util.Tools;


/**
 * dcr
 */
@Component
public class TFeedbackReplyServiceImpl implements TFeedbackReplyService {
    private static final Logger logger = LoggerFactory
            .getLogger(TFeedbackReplyServiceImpl.class);

    @Autowired
    TFeedbackReplyEntityMapper  tFeedbackReplyEntityMapper;
    @Autowired
    BackstageOperationRecordService  backstageOperationRecordService;
    
	@Override
	public String insertTFeedbackReply(Integer id, String replyContent,Integer hid,String mailbox) {
		String i="";
//		String i=ConstantsFinalUtil.CONSTANT_111;
//		if(Tools.isInteger(id) || Tools.isBank(replyContent) || Tools.isInteger(hid)){
//			return i=ConstantsFinalUtil.CONSTANT_110;
//		}
		TFeedbackReplyEntity tfre=new TFeedbackReplyEntity();
		tfre.setCreateTime(new Date());
		tfre.setFeedbackId(id);
		tfre.setReplyContent(replyContent);
		int b=tFeedbackReplyEntityMapper.insertSelective(tfre);
		if(b > 0){
			i="1";
			//添加记录
			 try{
			    backstageOperationRecordService.insertSelective(hid,mailbox,"回复操作,回复反馈的ID "+id+" 回复ID "+tfre.getId()+ "!");
			    }catch(Exception e){
			    	e.printStackTrace();
			    }
		}
		return i;
	}
   

}
